@echo off
  set Project=GNU
  rem set D=make pcre re2c regex sed
  set Archive=%Project%.7z
  if "" == "%1" goto :z
  set E=
  for %%p in (z e u) do if /i "%1" == "%%p" goto :%%p
  echo.
  echo usage z.bat [z^|e^|u]
goto :EOF

:e
  set E=_Release\*.* _Release\win32\*.* _Release\win64\*.*
:z
  if exist %Archive% call :run del /q %Archive%
  set F=*.bat *.ds? *.sln *.vcproj *.vcxproj *.vcxproj.filters *.txt gnu\*.* uname\*.* _work\*.* common\*.*
  set X=-x!*\.svn* -x!*\*.plg -x!*\*.opt -x!*\*.ncb -x!*\*.suo -x!*\*.*sdf -x!*\*.*proj.*.*.user -x!*\*.*proj.user
  call :runv 7z a -mx=9 -mmt=%NUMBER_OF_PROCESSORS% %Archive% %X% %F% %E%
  rem for %%d in (%D%) do call :add_dir %%d
goto :EOF

:run
  echo %*
  %* 1>NUL
goto :EOF
:runv
  echo %*
  %*
goto :EOF

:add_dir
  pushd %1
  call z.bat
  popd
  7z a -mx0 %Archive% %1\%1.7z
goto :EOF

:u
  call :runv 7z x -y -x!z.bat %Archive%
  rem for %%d in (%D%) do call :runv 7z x -y -o%%d %%d\%%d.7z
goto :EOF
